3.900 \(\int \frac {(c-i c \tan (e+f x))^2}{a+i a \tan (e+f x)} \, dx\)

Optimal. Leaf size=55 \[ \frac {2 i c^2}{f (a+i a \tan (e+f x))}-\frac {i c^2 \log (\cos (e+f x))}{a f}-\frac {c^2 x}{a} \]

[Out]

-c^2*x/a-I*c^2*ln(cos(f*x+e))/a/f+2*I*c^2/f/(a+I*a*tan(f*x+e))

________________________________________________________________________________________

Rubi [A]  time = 0.11, antiderivative size = 55, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 3, integrand size = 31, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.097, Rules used = {3522, 3487, 43} \[ \frac {2 i c^2}{f (a+i a \tan (e+f x))}-\frac {i c^2 \log (\cos (e+f x))}{a f}-\frac {c^2 x}{a} \]

Antiderivative was successfully verified.

[In]

Int[(c - I*c*Tan[e + f*x])^2/(a + I*a*Tan[e + f*x]),x]

[Out]

-((c^2*x)/a) - (I*c^2*Log[Cos[e + f*x]])/(a*f) + ((2*I)*c^2)/(f*(a + I*a*Tan[e + f*x]))

Rule 43

Int[((a_.) + (b_.)*(x_))^(m_.)*((c_.) + (d_.)*(x_))^(n_.), x_Symbol] :> Int[ExpandIntegrand[(a + b*x)^m*(c + d
*x)^n, x], x] /; FreeQ[{a, b, c, d, n}, x] && NeQ[b*c - a*d, 0] && IGtQ[m, 0] && ( !IntegerQ[n] || (EqQ[c, 0]
&& LeQ[7*m + 4*n + 4, 0]) || LtQ[9*m + 5*(n + 1), 0] || GtQ[m + n + 2, 0])

Rule 3487

Int[sec[(e_.) + (f_.)*(x_)]^(m_)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(n_), x_Symbol] :> Dist[1/(a^(m - 2)*b
*f), Subst[Int[(a - x)^(m/2 - 1)*(a + x)^(n + m/2 - 1), x], x, b*Tan[e + f*x]], x] /; FreeQ[{a, b, e, f, n}, x
] && EqQ[a^2 + b^2, 0] && IntegerQ[m/2]

Rule 3522

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((c_) + (d_.)*tan[(e_.) + (f_.)*(x_)])^(n_.), x_Symbol] :> Di
st[a^m*c^m, Int[Sec[e + f*x]^(2*m)*(c + d*Tan[e + f*x])^(n - m), x], x] /; FreeQ[{a, b, c, d, e, f, n}, x] &&
EqQ[b*c + a*d, 0] && EqQ[a^2 + b^2, 0] && IntegerQ[m] &&  !(IGtQ[n, 0] && (LtQ[m, 0] || GtQ[m, n]))

Rubi steps

\begin {align*} \int \frac {(c-i c \tan (e+f x))^2}{a+i a \tan (e+f x)} \, dx &=\left (a^2 c^2\right ) \int \frac {\sec ^4(e+f x)}{(a+i a \tan (e+f x))^3} \, dx\\ &=-\frac {\left (i c^2\right ) \operatorname {Subst}\left (\int \frac {a-x}{(a+x)^2} \, dx,x,i a \tan (e+f x)\right )}{a f}\\ &=-\frac {\left (i c^2\right ) \operatorname {Subst}\left (\int \left (\frac {1}{-a-x}+\frac {2 a}{(a+x)^2}\right ) \, dx,x,i a \tan (e+f x)\right )}{a f}\\ &=-\frac {c^2 x}{a}-\frac {i c^2 \log (\cos (e+f x))}{a f}+\frac {2 i c^2}{f (a+i a \tan (e+f x))}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]  time = 1.32, size = 74, normalized size = 1.35 \[ -\frac {c^2 \left (2 \tan ^{-1}(\tan (f x)) (\tan (e+f x)-i)+\log \left (\cos ^2(e+f x)\right )+i \tan (e+f x) \left (\log \left (\cos ^2(e+f x)\right )+2\right )-2\right )}{2 a f (\tan (e+f x)-i)} \]

Antiderivative was successfully verified.

[In]

Integrate[(c - I*c*Tan[e + f*x])^2/(a + I*a*Tan[e + f*x]),x]

[Out]

-1/2*(c^2*(-2 + Log[Cos[e + f*x]^2] + I*(2 + Log[Cos[e + f*x]^2])*Tan[e + f*x] + 2*ArcTan[Tan[f*x]]*(-I + Tan[
e + f*x])))/(a*f*(-I + Tan[e + f*x]))

________________________________________________________________________________________

fricas [A]  time = 0.49, size = 65, normalized size = 1.18 \[ -\frac {{\left (2 \, c^{2} f x e^{\left (2 i \, f x + 2 i \, e\right )} + i \, c^{2} e^{\left (2 i \, f x + 2 i \, e\right )} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right ) - i \, c^{2}\right )} e^{\left (-2 i \, f x - 2 i \, e\right )}}{a f} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((c-I*c*tan(f*x+e))^2/(a+I*a*tan(f*x+e)),x, algorithm="fricas")

[Out]

-(2*c^2*f*x*e^(2*I*f*x + 2*I*e) + I*c^2*e^(2*I*f*x + 2*I*e)*log(e^(2*I*f*x + 2*I*e) + 1) - I*c^2)*e^(-2*I*f*x
- 2*I*e)/(a*f)

________________________________________________________________________________________

giac [B]  time = 0.87, size = 125, normalized size = 2.27 \[ -\frac {\frac {i \, c^{2} \log \left (\tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + 1\right )}{a} - \frac {2 i \, c^{2} \log \left (\tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) - i\right )}{a} + \frac {i \, c^{2} \log \left (\tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) - 1\right )}{a} + \frac {3 i \, c^{2} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} + 10 \, c^{2} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) - 3 i \, c^{2}}{a {\left (\tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) - i\right )}^{2}}}{f} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((c-I*c*tan(f*x+e))^2/(a+I*a*tan(f*x+e)),x, algorithm="giac")

[Out]

-(I*c^2*log(tan(1/2*f*x + 1/2*e) + 1)/a - 2*I*c^2*log(tan(1/2*f*x + 1/2*e) - I)/a + I*c^2*log(tan(1/2*f*x + 1/
2*e) - 1)/a + (3*I*c^2*tan(1/2*f*x + 1/2*e)^2 + 10*c^2*tan(1/2*f*x + 1/2*e) - 3*I*c^2)/(a*(tan(1/2*f*x + 1/2*e
) - I)^2))/f

________________________________________________________________________________________

maple [A]  time = 0.21, size = 46, normalized size = 0.84 \[ \frac {2 c^{2}}{f a \left (\tan \left (f x +e \right )-i\right )}+\frac {i c^{2} \ln \left (\tan \left (f x +e \right )-i\right )}{f a} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((c-I*c*tan(f*x+e))^2/(a+I*a*tan(f*x+e)),x)

[Out]

2/f*c^2/a/(tan(f*x+e)-I)+I/f*c^2/a*ln(tan(f*x+e)-I)

________________________________________________________________________________________

maxima [F(-2)]  time = 0.00, size = 0, normalized size = 0.00 \[ \text {Exception raised: RuntimeError} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((c-I*c*tan(f*x+e))^2/(a+I*a*tan(f*x+e)),x, algorithm="maxima")

[Out]

Exception raised: RuntimeError >> ECL says: Error executing code in Maxima: expt: undefined: 0 to a negative e
xponent.

________________________________________________________________________________________

mupad [B]  time = 4.62, size = 48, normalized size = 0.87 \[ \frac {c^2\,2{}\mathrm {i}}{a\,f\,\left (1+\mathrm {tan}\left (e+f\,x\right )\,1{}\mathrm {i}\right )}+\frac {c^2\,\ln \left (\mathrm {tan}\left (e+f\,x\right )-\mathrm {i}\right )\,1{}\mathrm {i}}{a\,f} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((c - c*tan(e + f*x)*1i)^2/(a + a*tan(e + f*x)*1i),x)

[Out]

(c^2*2i)/(a*f*(tan(e + f*x)*1i + 1)) + (c^2*log(tan(e + f*x) - 1i)*1i)/(a*f)

________________________________________________________________________________________

sympy [A]  time = 0.33, size = 100, normalized size = 1.82 \[ \begin {cases} \frac {i c^{2} e^{- 2 i e} e^{- 2 i f x}}{a f} & \text {for}\: a f e^{2 i e} \neq 0 \\x \left (\frac {2 c^{2}}{a} + \frac {\left (- 2 c^{2} e^{2 i e} + 2 c^{2}\right ) e^{- 2 i e}}{a}\right ) & \text {otherwise} \end {cases} - \frac {2 c^{2} x}{a} - \frac {i c^{2} \log {\left (e^{2 i f x} + e^{- 2 i e} \right )}}{a f} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((c-I*c*tan(f*x+e))**2/(a+I*a*tan(f*x+e)),x)

[Out]

Piecewise((I*c**2*exp(-2*I*e)*exp(-2*I*f*x)/(a*f), Ne(a*f*exp(2*I*e), 0)), (x*(2*c**2/a + (-2*c**2*exp(2*I*e)
+ 2*c**2)*exp(-2*I*e)/a), True)) - 2*c**2*x/a - I*c**2*log(exp(2*I*f*x) + exp(-2*I*e))/(a*f)

________________________________________________________________________________________